package code;

public class ClassLoaderTest {
    public static void main(String[] args) {
        new S();
    }
}

class F {
    static int f = 1;
    int a = 2;

    static {
        System.out.printf("F静态代码块：f=%d\n", f);
        System.out.println("执行Father静态代码块");
    }
    {
        System.out.printf("F实例代码块：f=%d, a=%d\n", f, a);
        System.out.println("执行Father的实例代码块");
    }
    F() {
        System.out.printf("F构造方法：f=%d, a=%d\n", f, a);
        System.out.println("执行Father构造函数");
    }

}

class S extends F {
    static int s = 3;
    int b = 4;

    static {
        System.out.printf("S静态代码块：s=%d\n", s);
        System.out.println("执行Son静态代码块");
    }
    {
        System.out.printf("S实例代码块：s=%d, b=%d\n", s, b);
        System.out.println("执行Son的实例代码块");
    }

    S() {
        System.out.printf("S构造方法：s=%d, b=%d\n", s, b);
        System.out.println("执行Son构造函数");
    }
}


